<% layout('/layout/default.html', {title: '菜单管理', libs: ['validate','icheck']}){ %>
<div class="main-content">
	<div class="container-fluid">
		<div class="card-header">
			<i class="fas fa-pencil-alt"></i> ${menu.isNewRecord?'新增菜单':'编辑菜单'}
		</div>
		<#form:form id="inputForm" model="${menu}" action="${ctx}/sys/menu/save" method="post" class="form-horizontal">
		<div class="card-body">
			<#form:hidden path="id"/>
			<div class="row">
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title=""> 上级菜单:</label>
						<div class="col-lg-8 col-md-8 ">
							<#form:treeselect id="parentId" name="parent.id" value="${menu.parent.id!}" labelName="menu.parent.name"
							labelValue="${menu.parent.name!}" title="上级菜单" extId="${menu.id}" url="/sys/menu/treeData" notAllowSelectParent="true" cssClass="form-control-sm" />
						</div>
					</div>
				</div>

				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title="">
							<span style="color:red;">*</span> 名称:<i class="far fa-question-circle" hidden="hidden"></i></label>
						<div class="col-lg-8 col-md-8 ">
							<#form:input path="name" maxlength="64" class="form-control form-control-sm required " />
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title="点击菜单跳转的页面"> 链接:
							<i class="far fa-question-circle"></i></label>
						<div class="col-lg-8 col-md-8 ">
							<#form:input path="href" maxlength="64" class="form-control form-control-sm" />
						</div>
					</div>
				</div>
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title="链接地址打开的目标窗口，默认：mainFrame"> 目标:
							<i class="far fa-question-circle"></i></label>
						<div class="col-lg-8 col-md-8 ">
							<#form:input path="target" maxlength="64" class="form-control form-control-sm" />
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title=""> 图标:</label>
						<div class="col-lg-8 col-md-8 ">
							<#form:iconselect id="icon" name="icon" value="${menu.icon}"/>
						</div>
					</div>
				</div>
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title="排列顺序，升序。">
							<span style="color:red;">*</span> 排序:<i class="far fa-question-circle" hidden="hidden"></i>
							<i class="far fa-question-circle"></i></label>
						<div class="col-lg-8 col-md-8 ">
							<#form:input path="sort" maxlength="64" class="form-control form-control-sm required " />
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title="该菜单或操作是否显示到系统菜单中">
							<span style="color:red;">*</span> 可见:<i class="far fa-question-circle" hidden="hidden"></i>
							<i class="far fa-question-circle"></i>
						</label>
						<div class="col-lg-8 col-md-8 ">
							<#form:radio path="isShow" dictType="sys_show_hide" class="form-control required"/>
						</div>
					</div>
				</div>
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title="控制器中定义的权限标识，如：@RequiresPermissions(“权限标识”)"> 权限标识:
							<i class="far fa-question-circle"></i></label>
						<div class="col-lg-8 col-md-8 ">
							<#form:input path="permission" maxlength="255" class="form-control form-control-sm " />
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title=""> 备注信息：</label>
						<div class="col-lg-8 col-md-8 ">
							<#form:textarea path="remarks" rows="4" maxlength="255" class="form-control input-xxlarge "/>
						</div>
					</div>
				</div>
			</div>

		</div>

		<div class="box-footer">
			<div class="row">
				<div class="offset-md-2 col-md-10">
					<% if (hasPermi('sys:menu:edit')){ %>
					<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> 保 存</button>
					<% } %>
					<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="window.parent.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> 关 闭</button>
				</div>
			</div>
		</div>
	</#form:form>
</div>
</div>
<% } %>

<script type="text/javascript">
	$("#inputForm").validate({
		submitHandler: function(form){
			js.ajaxSubmitForm($(form), function(data){
				js.showMessage(data.message);
				if(data.result == 'true'){
					window.parent.closeCurrentTabPage(window.parent.refreshTab);
				}
			});
		}
	});

</script>

